﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OleDb;

namespace Cn.Edwon.Data {
    public class OledbAccess :AccessSupport,ICommonProcess {

        public Int32 CommonUpdateAction(string tsql) {
            this.Sql = tsql;
            using (OleDbConnection conn = new OleDbConnection(ConnectString)) {
                OleDbCommand odc = new OleDbCommand(tsql, conn);
                conn.Open();
                return odc.ExecuteNonQuery();
            }
        }
        
        public DataSet CommonSelectAction(string tsql, string dataname) {
            this.Sql = tsql;
            using (OleDbConnection conn = new OleDbConnection(ConnectString)) {
                OleDbCommand odc = new OleDbCommand(tsql, conn);
                odc.CommandType = CommandType.Text;
                conn.Open();
                using (OleDbDataAdapter da = new OleDbDataAdapter(odc)) {
                    DataSet ds = new DataSet();
                    da.Fill(ds, dataname);
                    return ds;
                }
            }
        }


    }
}
